package com.huatai.exchange.send;

import com.faneui.common.exception.BusinessException;
import com.faneui.common.utils.CloseUtils;
import com.huatai.exchange.dal.model.ExcCommunication;
import com.huatai.exchange.dal.model.ExcCustomer;
import com.huatai.exchange.facade.CommunicationContents;
import com.huatai.exchange.facade.Contents;
import com.huatai.exchange.integration.base.service.CommunicationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.OutputStream;
import java.util.Map;

@Service("fileSztSendService")
public class FileSztSendServiceImpl  implements FileSendService{

    @Autowired
    private CommunicationService communicationService ;

    @Override
    public void sendMessage(ExcCustomer customer, Map<String, Object> resvMap) throws BusinessException {
        boolean b = resvMap.get("fileNames") == null || StringUtils.isBlank(resvMap.get("fileNames").toString());
        String fileNames = b ? null : resvMap.get("fileNames").toString();
        String filePaths = b ? null : resvMap.get("filePaths").toString();
        String path = customer.getSztPath() ;
        communicationService.sendSzt(path,fileNames,filePaths);
    }
}
